package com.zynn.common.core.base;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * 公共的entity
 *
 * @author yu_chen
 * @date 2017-12-01 17:15
 **/
@Data
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @JsonSerialize(using=ToStringSerializer.class)
    @TableId(value = "id")
    private Long id;

    /**
     * 创建人
     */
    @JsonIgnore
    @TableField("create_user")
    private Long createUser;

    /**
     * 创建时间
     */
    @JsonIgnore
    @TableField("create_time")
    private Timestamp createTime;

    /**
     * 修改人
     */
    @JsonIgnore
    @TableField("update_user")
    private Long updateUser;

    /**
     * 修改时间
     */
    @JsonIgnore
    @TableField("update_time")
    private Timestamp updateTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Timestamp getCreateTime() {
        return createTime;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Timestamp getUpdateTime() {
        return updateTime;
    }
}
